package com.payment.web.controller.app;

import com.payment.common.base.AjaxResult;
import com.payment.system.service.IMoneyChangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author fuzhili
 * @Description: app端 资金流动处理
 * 资金变动告列表,
 * @date 2019/1/19 16:58
 */
@Controller
@RequestMapping("/app/moneyChange")
public class MoneyChangeAnnouncementController {
    @Autowired
    private IMoneyChangeService moneyChangeService;


    @RequestMapping(value = "/announcement/list")
    @ResponseBody
    public AjaxResult list() {
        return moneyChangeService.selectMoneyChangeListByWhere();
    }


    /**
     * 利润:返回今日利润  昨日利润的总额,本月分润总额
     *
     * @param merchantNo 用户编号
     * @return
     */
    @RequestMapping(value = "/profit")
    @ResponseBody
    public AjaxResult profit(String merchantNo) {
        return moneyChangeService.selectTodayProfitByMerchantId(merchantNo);
    }


    /**
     * 利润详情:app端今日利润列表或昨日利润列表//本月列表
     *
     * @param merchantNo 用户编号
     * @return
     */
    @RequestMapping(value = "/profit/detailsList")
    @ResponseBody
    public AjaxResult profitDetails(String merchantNo, String type, Integer pageNum, Integer pageSize) {
        return moneyChangeService.profitDetails(merchantNo, type, pageNum, pageSize);
    }

    /**
	 * 利润详情:app端今日利润列表或昨日利润列表//本月列表 shopping
	 *
	 * @param merchantNo
	 *            用户编号
	 * @return
	 */
    @RequestMapping(value = "/profit/detailsListByShopping")
    @ResponseBody
    public AjaxResult profitDetailsByShopping(String merchantNo, String type, Integer pageNum, Integer pageSize) {
        return moneyChangeService.profitDetailsByShopping(merchantNo, type, pageNum, pageSize);
    }


    /**
     * 根据月份统计利润：刷卡/办卡/贷款
     * @param merchantNo
     * @return 刷卡分润，贷款，办卡
     */
    @PostMapping("/profit/month")
    @ResponseBody
    public AjaxResult selectProfitByMonth(String merchantNo,String merchantId, String month) {
        return   moneyChangeService.selectProfitByMonth(merchantNo,merchantId,month);

    }

    /**
     * 提现记录
     *
     * @return
     */
    @RequestMapping(value = "/cashWithdrawal/list")
    @ResponseBody
    public AjaxResult cashWithdrawalList(String merchantId, Integer pageNum, Integer pageSize) {
        return moneyChangeService.selectCashWithdrawalList(merchantId, pageNum, pageSize);
    }
}
